package svc

import (
	"os"
)

type File struct {
	DataFile *os.File
	Info     *FileInfo
}

func (f *File) Write(b []byte) (n int, err error) {
	n, err = f.DataFile.WriteAt(b, int64(f.Info.Offset))
	return
}

func (f *File) Read(b []byte) (n int, err error) {
	n, err = f.DataFile.ReadAt(b, int64(f.Info.Offset))
	if err != nil {
		return 0, err
	}
	return
}